package com.eaoa.uc.permission.bo;

import com.eaoa.base.EABaseBusinessObject;
import com.eaoa.dao.pub.PubRoleDAO;
import com.eaoa.vo.pub.PubRole;

public class RoleEditBO extends EABaseBusinessObject {

	private java.lang.Long roleno;

	private PubRole vo;

	private PubRoleDAO dao = new PubRoleDAO();

	public RoleEditBO(PubRole vo) {
		super();
		this.vo = vo;
	}

	protected void performBusinessLogic() {

		if (vo.getRoleno() == null) {
			roleno = dao.save(vo);
		} else {
			
			PubRole po = (PubRole) dao.loadAndLock(vo.getRoleno());
			po.setRolename(vo.getRolename());
			po.setRolecode(vo.getRolecode());
			po.setRoledesc(vo.getRoledesc());

			dao.update(po);
		}
	}

}